home *** CD-ROM | disk | FTP | other *** search
Text File | 1980-01-04 | 40.1 KB | 1,974 lines |
-
-
- * Code include file for handling clue list generation.
- * Includes all the requesters for this (except the
- * InfoReq used for other things too) and the gadgetry
- * for it too. Images live in a separate file.
-
-
- * NewClueList(a6) -> d0
- * a6 = ptr to main program variables
-
- * Generate the clue list information from the grid.
- * Generate clue numbers, start squares of clues and
- * prepare for text management.
-
- * returns d0=0 if failed to do it for some reason,
- * d0=-1 if successful.
-
- * d0/d6-d7/a0-a2 corrupt
-
-
- NewClueList bclr #4,applic_flag1(a6) ;kill clue list flag
-
- move.l clue_list(a6),a0 ;ensure clue list
- clr.l clh_AcList(a0) ;pointers not
- clr.l clh_DnList(a0) ;valid ones at start
-
- btst #6,applic_flag1(a6) ;which grid type?
- bne NCL_b11 ;skip if type 2 grid
-
-
- * Here get information for Type 1 grid. First find out how many
- * clues there are.
-
-
- move.l grid_array(a6),a0 ;ptr to grid array
- move.l clue_list(a6),a1 ;ptr to header
-
- moveq #0,d0
-
- move.w d0,clh_AcCount(a1) ;clear clue
- move.w d0,clh_DnCount(a1) ;counts
-
- moveq #1,d7 ;set square no.
- swap d7 ;(1,1)
- move.w #1,d7
-
- move.w grid_down(a6),d6 ;set row & column
- swap d6 ;limits
- move.w grid_across(a6),d6
- move.w d6,d5
- add.w d5,d5
- neg.w d5 ;use as backward &
- swap d5 ;forward offsets
- move.w d6,d5 ;to next & prev rows
- add.w d5,d5
-
- NCL_l1 move.w (a0),d0 ;get array element
-
- tst.b d0 ;black square?
- beq.s NCL_b1 ;skip if so
-
-
- * First of all, test for start of across clue.
-
-
- cmp.w #1,d7 ;start of row?
- beq.s NCL_b2 ;don't test prev if so
-
- tst.b -1(a0) ;prev square black?
- bne.s NCL_b3 ;skip if not
-
- NCL_b2 cmp.w d6,d7 ;end square of row?
- beq.s NCL_b3 ;don't test next if so
-
- tst.b 3(a0) ;next square white?
- beq.s NCL_b3 ;skip if not
-
-
- * If we've fallen through to here, then we've found the start of
- * an across clue. Mark it as such and store back.
-
-
- bset #15,d0 ;set 'across start'
- addq.w #1,clh_AcCount(a1) ;and increment count
-
-
- * Now test for start of down clue.
-
-
- NCL_b3 swap d6 ;get down square
- swap d7 ;position data
-
- cmp.w #1,d7 ;start of column?
- beq.s NCL_b4 ;don't test prev if so
-
- swap d5 ;get negative offset
- lea 1(a0,d5.w),a2
- swap d5
- tst.b (a2) ;prev square black?
- bne.s NCL_b5 ;skip if not
-
- NCL_b4 cmp.w d6,d7 ;end square of column?
- beq.s NCL_b5 ;don't test next if so
-
- tst.b 1(a0,d5.w) ;next square white?
- beq.s NCL_b5 ;skip if not
-
-
- * If we've fallen through to here, then we've found the start
- * of a down clue. Mark it as such.
-
-
- bset #14,d0 ;set 'down start'
- addq.w #1,clh_DnCount(a1) ;& increment count
-
- NCL_b5 swap d6 ;recover across
- swap d7 ;position data
-
- NCL_b1 move.w d0,(a0)+ ;store data back
-
- addq.w #1,d7 ;next square in row
- cmp.w d6,d7 ;hit end?
- bls.s NCL_l1 ;back if not
-
- move.w #1,d7 ;else reset to start
- swap d6 ;and get column
- swap d7 ;data
-
- addq.w #1,d7 ;next column
- cmp.w d6,d7 ;end of grid?
- bhi.s NCL_b6 ;exit if so
-
- swap d6 ;recover row data
- swap d7
-
- bra.s NCL_l1 ;and continue
-
-
- * Now begin creating the list data entries. Reserve some memory
- * for the list entries in each case. If can't do it, abort with
- * the failure code.
-
-
- NCL_b6 move.l clue_list(a6),a0 ;ptr to header
-
- move.w #cle_sizeof,d0 ;amount of memory
- mulu clh_AcCount(a0),d0 ;to reserve
-
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
-
- CALLEXEC AllocMem
-
- move.l clue_list(a6),a0
- move.l d0,clh_AcList(a0) ;save ptr
- beq NCL_Done ;exit if nonexistent
-
- move.w #cle_sizeof,d0
- mulu clh_DnCount(a0),d0
-
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
-
- CALLEXEC AllocMem
-
- move.l clue_list(a6),a0
- move.l d0,clh_DnList(a0) ;save ptr
- beq NCL_Done ;exit if nonexistent
-
-
- * If we reach here, then we've got memory for the clue lists.
- * Now begin setting them up.
-
-
- move.l grid_array(a6),a0
-
- move.l clue_list(a6),a1
-
- move.l clh_DnList(a1),a2 ;ptr to Down list
- move.l clh_AcList(a1),a1 ;ptr to Across list
-
- moveq #1,d7 ;start at square
- swap d7 ;(1,1)
- move.w #1,d7
-
- move.w grid_down(a6),d6
- swap d6
- move.w grid_across(a6),d6
-
- moveq #1,d5 ;1st clue number
-
- NCL_l2 move.w (a0),d0 ;get grid data
-
- move.w d0,d1
- and.w #$C000,d1 ;any clue data?
- beq.s NCL_b9 ;no, so skip
-
- bclr #15,d0 ;was it an Across clue?
- beq.s NCL_b7 ;no, so skip
-
- move.w d7,cle_AcSq(a1) ;set square pos for this
- swap d7 ;clue
- move.w d7,cle_DnSq(a1)
- swap d7
-
- move.w d5,cle_Num(a1) ;clue number
- clr.l cle_Text(a1) ;no text yet!
- clr.b cle_Solved ;not solved yet!
-
- add.w #cle_sizeof,a1 ;ready the next entry
-
- NCL_b7 bclr #14,d0 ;was it a Down clue?
- beq.s NCL_b8 ;no, so skip
-
- move.w d7,cle_AcSq(a2) ;set square pos for this
- swap d7 ;clue
- move.w d7,cle_DnSq(a2)
- swap d7
-
- move.w d5,cle_Num(a2) ;clue number
- clr.l cle_Text(a2) ;no text yet!
- clr.b cle_Solved ;not solved yet!
-
- add.w #cle_sizeof,a2 ;ready the next entry
-
- NCL_b8 addq.w #1,d5 ;next clue number
-
- NCL_b9 move.w d0,(a0)+ ;save square back
-
- addq.w #1,d7 ;next square across
- cmp.w d6,d7 ;end of row?
- bls.s NCL_l2 ;back if not
-
- move.w #1,d7 ;reset to start of row
-
- swap d7 ;get down square
- swap d6 ;position
-
- addq.w #1,d7 ;next square down
- cmp.w d6,d7 ;end of grid?
- bhi.s NCL_b10 ;exit if so
-
- swap d6 ;get across square
- swap d7 ;position
-
- bra.s NCL_l2 ;and back for more
-
-
- * If we get here, then we've succeeded. A clue list table exists.
-
-
- NCL_b10 bset #4,applic_flag1(a6) ;set clue exists flag
- moveq #-1,d0
-
- NCL_Done rts
-
-
- * We come here if it's a Type 2 crossword. First find out how
- * many clues there are, and where they are as for Type 1. But
- * branch back to allocate the memory etc.
-
-
- NCL_b11 move.l grid_array(a6),a0 ;ptr to grid array
- move.l clue_list(a6),a1 ;ptr to header
-
- moveq #0,d0
-
- move.w d0,clh_AcCount(a1) ;clear clue
- move.w d0,clh_DnCount(a1) ;counts
-
- moveq #1,d7 ;set square no.
- swap d7 ;(1,1)
- move.w #1,d7
-
- move.w grid_down(a6),d6 ;set row & column
- swap d6 ;limits
- move.w grid_across(a6),d6
- move.w d6,d5
- add.w d5,d5
- neg.w d5 ;use as backward &
-
- ; swap d5 ;forward offsets
- ; move.w d6,d5 ;to next & prev rows
- ; add.w d5,d5
-
-
- NCL_l3 move.w (a0),d0 ;get grid array data
-
-
- * First of all, test for start of across clue.
-
-
- cmp.w #1,d7 ;start of row?
- beq.s NCL_b12 ;don't test prev if so
-
- btst #0,-2(a0) ;prev square barred?
- beq.s NCL_b13 ;skip if not
-
- NCL_b12 cmp.w d6,d7 ;end square of row?
- beq.s NCL_b13 ;don't test next if so
-
- btst #8,d0 ;this square barred?
- bne.s NCL_b13 ;skip if so
-
-
- * If we've fallen through to here, then we've found the start of
- * an across clue. Mark it as such and store back.
-
-
- bset #15,d0 ;set 'across start'
- addq.w #1,clh_AcCount(a1) ;and increment count
-
-
- * Now test for start of down clue.
-
-
- NCL_b13 swap d6 ;get down square
- swap d7 ;position data
-
- cmp.w #1,d7 ;start of column?
- beq.s NCL_b14 ;don't test prev if so
-
- ; swap d5 ;get negative offset
- lea 0(a0,d5.w),a2
- ; swap d5
- btst #1,(a2) ;prev square barred?
- beq.s NCL_b15 ;skip if not
-
- NCL_b14 cmp.w d6,d7 ;end square of column?
- beq.s NCL_b15 ;don't test next if so
-
- btst #9,d0 ;this square barred?
- bne.s NCL_b15 ;skip if so
-
-
- * If we've fallen through to here, then we've found the start
- * of a down clue. Mark it as such.
-
-
- bset #14,d0 ;set 'down start'
- addq.w #1,clh_DnCount(a1) ;& increment count
-
- NCL_b15 swap d6 ;recover across
- swap d7 ;position data
-
- move.w d0,(a0)+ ;store data back
-
- addq.w #1,d7 ;next square in row
- cmp.w d6,d7 ;hit end?
- bls.s NCL_l3 ;back if not
-
- move.w #1,d7 ;else reset to start
- swap d6 ;and get column
- swap d7 ;data
-
- addq.w #1,d7 ;next column
- cmp.w d6,d7 ;end of grid?
- bhi NCL_b6 ;exit if so
-
- swap d6 ;recover row data
- swap d7
-
- bra.s NCL_l3 ;and continue
-
-
- * DisposeClueList(a6)
- * a6 = ptr to main program variables
-
- * Get rid of clue lists & deallocate the memory
-
- * DOES NOT DEALLOCATE TEXTS MEMORY!
-
- * d0-d1/a0-a1 corrupt
-
-
- DisposeClueList move.l clue_list(a6),a0
-
- move.l clh_AcList(a0),d0 ;Across list exists?
- beq.s DCL_1 ;skip if not
-
- move.l d0,a1
- move.w #cle_sizeof,d0
- mulu clh_AcCount(a0),d0 ;get rid of Across
- CALLEXEC FreeMem ;list
-
- move.l clue_list(a6),a0 ;and ensure that
- clr.l clh_AcList(a0) ;it doesn't exist
-
- DCL_1 move.l clue_list(a6),a0
-
- move.l clh_DnList(a0),d0 ;Down list exists?
- beq.s DCL_2 ;skip if not
-
- move.l d0,a1
- move.w #cle_sizeof,d0
- mulu clh_DnCount(a0),d0 ;get rid of Across
- CALLEXEC FreeMem ;list
-
- move.l clue_list(a6),a0 ;and ensure that
- clr.l clh_DnList(a0) ;it doesn't exist
-
- DCL_2 bclr #4,applic_flag1(a6) ;kill clue exists flag
-
- rts
-
-
- ATSIZE equ 60 ;assumed average no of chars in clue
-
-
- * AllocText(a6) -> d0
- * a6 = ptr to main program variables
- * Create the memory area for the ClueTexts once
- * the clue list is in existence.
-
- * Returns d0=0 if failed for some reason,
- * d0=-1 if successful.
-
- * d0-d1/a0 corrupt
-
-
- AllocText move.l clue_list(a6),a0 ;get ptr to clue list
- move.l clh_AcList(a0),d0 ;Across list ptr exists?
- beq.s ATxt_Done ;exit if not
-
- move.l clh_DnList(a0),d0 ;Down list ptr exists?
- beq.s ATxt_Done ;exit if not
-
- move.w clh_AcCount(a0),d0
- add.w clh_DnCount(a0),d0 ;total no of clues...
-
- mulu #ATSIZE,d0 ; * avg no of chars per clue
-
- move.l #MEMF_PUBLIC+MEMF_CLEAR,d1
-
- CALLEXEC AllocMem ;got memory area?
-
- move.l d0,clue_texts(a6) ;soon find out...
-
- beq.s ATxt_Done ;no we haven't, so skip
-
- move.l d0,clue_endptr(a6) ;else set things up
- clr.l clue_thisone(a6) ;for clue editing
-
- moveq #-1,d0 ;and signal success
-
- ATxt_Done rts
-
-
- * FreeText(a6)
- * a6 = ptr to main program variables
-
- * Free clue text memory area requested by AllocText() above.
-
- * d0/a0-a1 corrupt
-
-
- FreeText move.l clue_texts(a6),d0 ;ptr exists?
- beq.s FTxt_Done ;no, don't free
-
- move.l d0,a1
- move.l clue_list(a6),a0
- move.w clh_AcCount(a0),d0
- add.w clh_DnCount(a0),d0
-
- mulu #ATSIZE,d0
-
- CALLEXEC FreeMem ;release the memory
-
- clr.l clue_texts(a6) ;ensure nonexistent
-
- FTxt_Done rts
-
-
-
- * CreateClueList(a6)
- * a6 = ptr to main program variables
-
- * Call all of the routines required to create clue lists
- * and report any failures to do so.
-
-
- * d0-d7/a0-a2 corrupt
-
-
- CreateClueList btst #1,applic_flag2(a6) ;HELP on?
- beq.s CCL_00 ;skip if not
-
- lea Help_ML(pc),a0 ;else pop up
- moveq #5,d0 ;help box
- bsr _PopUpQR
-
- beq.s CCL_02 ;skip if user cancels
-
-
- * Come here directly if no HELP on. Check if there are any white
- * squares in the grid.
-
-
- CCL_00 tst.w WSCount(a6) ;blank grid?
- bne.s CCL_01 ;skip if not
-
-
- * All black squares, so clue list can't exist. Tell user, and leave
- * this routine NOW.
-
-
- lea NWSListW(pc),a0 ;inform user that clue
- lea IRT_1(pc),a1 ;list construction is
- moveq #4,d0 ;pointless on a
-
- move.l a0,irt_tlist(a6) ;blank grid
- move.l a1,irt_itext(a6)
- move.w d0,irt_count(a6)
-
- bsr LinkInfoText
- bsr ShowInfoReq
-
- CCL_02 rts
-
-
- * If we reach here, then there is a valid grid. If there is already a
- * clue list, warn the user that it'll be scrapped by the new one.
- * Ask user if this is wanted.
-
-
- CCL_01 move.l clue_list(a6),d0 ;does it exist?
- beq.s CCL_X ;no it doesn't so do it now
-
- move.l d0,a0 ;pointer to it
-
- tst.l clh_AcList(a0) ;Across list exists?
- bne.s CCL_Y ;skip if it does
-
- tst.l clh_DnList(a0) ;Down List exists?
- beq.s CCL_X ;skip if it doesn't
-
- CCL_Y lea KCListW(pc),a0 ;pop up a QueryReq if a
- lea QRT_1(pc),a1 ;clue list exists
- moveq #4,d0 ;to warn user
-
- move.l a0,irt_tlist(a6)
- move.l a1,irt_itext(a6)
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;YES gadget hit?
- bne.s CCL_X ;continue if so
-
- rts ;else done
-
-
- * Come down here only if user REALLY wants to create a new
- * clue list. Scrap the old one & replace with a pristine newq
- * one.
-
-
- CCL_X bclr #4,applic_flag1(a6) ;clear exists flag
-
- bsr DisposeClueList ;ensure that none exists
-
- bsr FreeText ;ensure this also
-
- CCL_Doit bsr HangPointer ;Tell user to wait
-
- lea DoingClues(pc),a0
- lea IRT_1(pc),a1
- moveq #5,d0
-
- move.l a0,irt_tlist(a6) ;pop up InfoReq to tell
- move.l a1,irt_itext(a6) ;user that clue list
- move.w d0,irt_count(a6) ;now exists
-
- bsr LinkInfoText
- bsr ShowInfoReq
-
- bsr NewClueList ;create clue list entries
- tst.l d0 ;successful?
- beq.s CCL_1 ;no, so exit
-
- bsr AllocText ;create clue text buffer
- tst.l d0 ;successful?
- beq.s CCL_2 ;no, so exit
-
- bsr MainPointer ;recover main pointer
-
- bset #4,applic_flag1(a6) ;& set exists flag
-
- rts
-
-
- * Arrive here if any allocation failed.
-
-
- CCL_2 bsr FreeText ;scrap any existing cluetexts
-
- CCL_1 bsr DisposeClueList ;scrap existing cluelists
-
- bsr MainPointer ;tell user all's OK again
-
- rts
-
-
- * StrLen(a0) -> d0
- * a0 = ptr to string
-
- * returns length of an ASCIIZ string in d0
-
- * no other registers corrupt !
-
-
- StrLen move.l a0,-(sp) ;save ptr
- moveq #0,d0 ;no of chars initially=0
-
- StrL1 tst.b (a0)+ ;this char EOS?
- beq.s StrL2 ;skip if so
- addq.w #1,d0 ;else update string length
- bra.s StrL1 ;and back for more
-
- StrL2 move.l (sp)+,a0 ;recover ptr
- rts ;done!
-
-
- * ReOrderText(a6)
- * a6 = ptr to main program variables
-
- * Re-order the text strings within the text space following
- * a deletion of a clue text, and update the clue list details.
-
- * d0-d2/a0-a2 corrupt
-
-
- ReOrderText move.l clue_thisone(a6),d0 ;get current string ptr
- beq ROT_b3 ;doesn't exist-skip
- move.l d0,a0
-
- bsr.s StrLen ;how long is it?
- addq.w #1,d0 ;including the EOS
- move.w d0,clue_editlen(a6) ;and save it
-
- move.l clue_endptr(a6),a1 ;ptr to end of texts
-
- move.l a0,a2 ;a0 = ptr to dst
- add.w d0,a2 ;a2 = ptr to src
-
- ROT_l1 move.b (a2)+,(a0)+ ;copy strings
- cmp.l a1,a0 ;done them all?
- bls.s ROT_l1 ;back if not
-
- sub.w d0,a1
- move.l a1,clue_endptr(a6) ;new end of texts
-
- move.l clue_thisone(a6),a1 ;ptr to current string
-
- move.l clue_list(a6),a0
- move.l clh_AcList(a0),d0 ;get ptr to Across list
- beq.s ROT_b1 ;woops! doesn't exist!
-
- move.w clh_AcCount(a0),d1 ;no. to check
- move.l d0,a0 ;copy pointer
- move.w clue_editlen(a6),d0 ;and amount to move
-
- ROT_l2 move.l cle_Text(a0),d2 ;check text ptr
- beq.s ROT_b2 ;doesn't exit-get next
-
- cmp.l a1,d2 ;before moved texts?
- bcs.s ROT_b2 ;yes, so skip
- bne.s ROT_b2a ;after, so change
-
- clr.l cle_Text(a0) ;kill ptr if equal
- bra.s ROT_b2
-
- ROT_b2a move.l d2,a2
- sub.w d0,a2 ;else reorder
- move.l a2,cle_Text(a0) ;and replace
-
- ROT_b2 add.w #cle_sizeof,a0 ;next clue list entry
- subq.w #1,d1 ;done them all?
- bne.s ROT_l2 ;skip back if not
-
- ROT_b1 move.l clue_list(a6),a0
- move.l clh_DnList(a0),d0 ;get ptr to Down list
- beq.s ROT_b3 ;woops! doesn't exist!
-
- move.w clh_DnCount(a0),d1 ;no. to check
- move.l d0,a0 ;copy pointer
- move.w clue_editlen(a6),d0 ;and amount to move
-
- ROT_l3 move.l cle_Text(a0),d2 ;check text ptr
- beq.s ROT_b4 ;doesn't exit-get next
-
- cmp.l a1,d2 ;before moved texts?
- bcs.s ROT_b4 ;yes, so skip
- bne.s ROT_b4a ;after, so change
-
- clr.l cle_Text(a0) ;kill ptr if equal
- bra.s ROT_b4
-
- ROT_b4a move.l d2,a2
- sub.w d0,a2 ;else reorder
- move.l a2,cle_Text(a0) ;and replace
-
- ROT_b4 add.w #cle_sizeof,a0 ;next clue list entry
- subq.w #1,d1 ;done them all?
- bne.s ROT_l3 ;skip back if not
-
-
- * Now, clear clue_thisone to prevent an unwanted repeat reordering
- * (which won't be needed unless user selects clue rubout)
-
-
- ROT_b3 clr.l clue_thisone(a6)
-
- rts
-
-
- * PickClue(a6)
- * a6 = ptr to main program variables
-
- * Pop up "Pick Clue" requester, then set P flag
- * to alter mouse button function.
-
-
- PickClue lea Pick_Info(pc),a0
- lea IRT_1(pc),a1
- moveq #6,d0
- move.l a0,irt_tlist(a6)
- move.l a1,irt_itext(a6)
- move.w d0,irt_count(a6)
-
- bsr LinkInfoText
-
- bsr ShowInfoReq ;pop up requester
-
- bset #3,applic_flag1(a6) ;set Picking flag
-
- rts
-
-
- * WhichClue(a6)
- * a6 = ptr to main program variables
-
- * Find which clue is being selected in both across and
- * down lists.
-
- * d0-d3/d7/a0-a2 corrupt
-
-
- WhichClue moveq #0,d0 ;initially picked clue
-
- move.w d0,pick_across(a6)
- move.w d0,pick_down(a6)
-
- move.w pick_hpos(a6),d0 ;picked clue square
- move.w pick_vpos(a6),d1 ;position
-
- move.l clue_list(a6),a0 ;ptr to clue list
-
- btst #6,applic_flag1(a6) ;which crossword type?
- bne WCH_10 ;skip if type 2
-
-
- * First, try an across clue. If match found, then store and continue.
- * First try to force the square pos to the start of an across clue if
- * it is one.
-
-
- WCH_1 move.w d1,d2 ;create offset to square
- subq.w #1,d2
- mulu grid_across(a6),d2
- move.l d2,a2
-
- move.w d0,d2
- subq.w #1,d2
- add.w d2,a2 ;this is offset in words
- add.l a2,a2 ;and this is it in bytes!
-
- add.l grid_array(a6),a2 ;ptr to square
-
- move.w d0,d2 ;copy horiz pos
-
- cmp.w #1,d0 ;already at LHS edge?
- beq.s WCH_2 ;skip if so
-
- WCH_3 tst.b -1(a2) ;prev square black?
- beq.s WCH_2 ;stuck with this if so
-
- subq.l #2,a2 ;point to prev
- subq.w #1,d2 ;prev horiz pos
- cmp.w #1,d2 ;hit LHS?
- bne.s WCH_3 ;back if not
-
-
- * Here, either hit start of across clue, LHS, or it's a down clue.
-
-
- WCH_2 cmp.w d2,d0 ;moved at all?
- bne.s WCH_4 ;yes, so true across clue
-
- cmp.w grid_across(a6),d2 ;RHS edge?
- beq.s WCH_5 ;not across clue!
-
- tst.b 3(a2) ;next square white?
- beq.s WCH_5 ;no, so not across clue
-
-
- * Here, it's a true across clue. If so, save square position
- * and begin scanning across list for clue number.
- * Here d0/d1 should point to a valid square for comparison.
-
-
- WCH_4 move.l clh_AcList(a0),a1 ;ptr to list
- move.w clh_AcCount(a0),d7 ;no to scan
-
- WCH_L1 cmp.w cle_AcSq(a1),d2 ;match horiz pos?
- bne.s WCH_B1 ;no
- cmp.w cle_DnSq(a1),d1 ;match vert pos?
- bne.s WCH_B1 ;no
-
- move.w cle_Num(a1),pick_across(a6)
- move.l a1,clue_AcEntry(a6) ;save ptr to list entry
-
- move.w d2,pick_Ach(a6) ;else set up the
- move.w d1,pick_Acv(a6) ;clue information
- bra.s WCH_5 ;and continue on
-
- WCH_B1 add.w #cle_sizeof,a1 ;next clue list entry
- subq.w #1,d7 ;done them all?
- bne.s WCH_L1 ;back if not
-
-
- * Here, try a down clue.
-
-
- WCH_5 move.w grid_across(a6),d3
-
- add.w d3,d3 ;amount to subtract for next down
-
- neg.w d3 ;for convenience
-
- move.w d1,d2 ;create offset to square
- subq.w #1,d2
- mulu grid_across(a6),d2
- move.l d2,a2
-
- move.w d0,d2
- subq.w #1,d2
- add.w d2,a2 ;this is offset in words
- add.l a2,a2 ;and this is it in bytes!
-
- add.l grid_array(a6),a2 ;ptr to square
-
- move.w d1,d2 ;copy vert pos
-
- cmp.w #1,d1 ;already at top edge?
- beq.s WCH_6 ;skip if so
-
- WCH_7 tst.b 1(a2,d3.w) ;prev square black?
- beq.s WCH_6 ;stuck with this if so
-
- add.w d3,a2 ;point to prev (address add!)
- subq.w #1,d2 ;prev vert pos
- cmp.w #1,d2 ;hit top?
- bne.s WCH_7 ;back if not
-
-
- * Here, either hit start of down clue, or top.
-
-
- WCH_6 cmp.w d2,d1 ;moved at all?
- bne.s WCH_8 ;yes, so true down clue
-
- cmp.w grid_down(a6),d2 ;bottom edge?
- beq.s WCH_9 ;not down clue!
-
- neg.w d3 ;positive offset once more
- tst.b 1(a2,d3.w) ;next square white?
- beq.s WCH_9 ;no, so not down clue
-
-
- * Here, it's a true down clue. If so, save square position
- * and begin scanning down list for clue number.
-
-
- WCH_8 move.l clh_DnList(a0),a1 ;ptr to list
- move.w clh_DnCount(a0),d7 ;no to scan
-
- WCH_L2 cmp.w cle_AcSq(a1),d0 ;match horiz pos?
- bne.s WCH_B2 ;no
- cmp.w cle_DnSq(a1),d2 ;match vert pos?
- bne.s WCH_B2 ;no
-
- move.w cle_Num(a1),pick_down(a6)
- move.l a1,clue_DnEntry(a6) ;save ptr to list entry
-
- move.w d0,pick_Dnh(a6) ;else set up the
- move.w d2,pick_Dnv(a6) ;clue information
- bra.s WCH_9 ;and continue on
-
- WCH_B2 add.w #cle_sizeof,a1 ;next clue list entry
- subq.w #1,d7 ;done them all?
- bne.s WCH_L2 ;back if not
-
-
- * Now true across/down clues found, and details saved. Bye!!
-
-
- WCH_9 rts
-
-
- * Here, do the same for Type 2 crossword. First, try an across clue.
-
-
- WCH_10 move.w d1,d2 ;create offset to square
- subq.w #1,d2
- mulu grid_across(a6),d2
- move.l d2,a2
-
- move.w d0,d2
- subq.w #1,d2
- add.w d2,a2 ;this is offset in words
- add.l a2,a2 ;and this is it in bytes!
-
- add.l grid_array(a6),a2 ;ptr to square
-
- move.w d0,d2 ;copy horiz pos
-
- cmp.w #1,d0 ;already at LHS edge?
- beq.s WCH_S1 ;skip if so
-
-
- WCH_12 btst #0,-2(a2) ;prev square vert barred?
- bne.s WCH_13 ;skip if so
-
- subq.l #2,a2 ;point to prev
- subq.w #1,d2 ;prev horiz pos
- cmp.w #1,d2 ;hit LHS?
- bne.s WCH_12 ;back if not.
-
-
- * Here either hit start of across clue, LHS, or it's a down clue.
-
-
- WCH_13 cmp.w d2,d0 ;moved at all?
- bne.s WCH_14 ;yes, so true across clue
-
- cmp.w grid_across(a6),d2 ;RHS edge?
- beq.s WCH_15 ;yes, so not across clue
-
- WCH_S1 btst #0,(a2) ;this square vert barred?
- bne.s WCH_15 ;yes, so not across clue
-
-
- * Here it's a true across clue, so store the details.
-
-
- WCH_14 move.l clh_AcList(a0),a1 ;ptr to list
- move.w clh_AcCount(a0),d7 ;no to scan
-
- WCH_L3 cmp.w cle_AcSq(a1),d2 ;match horiz pos?
- bne.s WCH_B3 ;no
- cmp.w cle_DnSq(a1),d1 ;match vert pos?
- bne.s WCH_B3 ;no
-
- move.w cle_Num(a1),pick_across(a6)
- move.l a1,clue_AcEntry(a6) ;save ptr to list entry
-
- move.w d2,pick_Ach(a6) ;else set up the
- move.w d1,pick_Acv(a6) ;clue information
- bra.s WCH_15 ;and continue on
-
- WCH_B3 add.w #cle_sizeof,a1 ;next clue list entry
- subq.w #1,d7 ;done them all?
- bne.s WCH_L3 ;back if not
-
-
- * Here, try a down clue.
-
-
- WCH_15 move.w d1,d2 ;else create offset to square
- subq.w #1,d2
- mulu grid_across(a6),d2
- move.l d2,a2
-
- move.w d0,d2
- subq.w #1,d2
- add.w d2,a2 ;this is offset in words
- add.l a2,a2 ;and this is it in bytes!
-
- add.l grid_array(a6),a2 ;ptr to square
-
- move.w grid_across(a6),d3
-
- add.w d3,d3 ;amount to subtract for next down
- neg.w d3 ;neg it for convenience (see below)
-
- move.w d1,d2 ;copy vert pos
-
- cmp.w #1,d1 ;already at top edge?
- beq.s WCH_S2 ;skip if so
-
- WCH_17 btst #1,0(a2,d3.w) ;prev square horiz barred?
- bne.s WCH_16 ;skip if so
-
- add.w d3,a2 ;point to prev
- subq.w #1,d2 ;prev vert pos
- cmp.w #1,d2 ;hit top?
- bne.s WCH_17 ;back if not.
-
-
- * Here either hit start of down clue, or top of grid.
-
-
- WCH_16 cmp.w d2,d1 ;moved at all?
- bne.s WCH_18 ;yes, so true down clue
-
- cmp.w grid_down(a6),d2 ;bottom edge?
- beq.s WCH_19 ;yes, so not down clue
-
- WCH_S2 btst #1,(a2) ;this square horiz barred?
- bne.s WCH_19 ;yes, so not down clue
-
-
- * Here it's a true down clue, so store the details.
-
-
- WCH_18 move.l clh_DnList(a0),a1 ;ptr to list
- move.w clh_DnCount(a0),d7 ;no to scan
-
- WCH_L4 cmp.w cle_AcSq(a1),d0 ;match horiz pos?
- bne.s WCH_B4 ;no
- cmp.w cle_DnSq(a1),d2 ;match vert pos?
- bne.s WCH_B4 ;no
-
- move.w cle_Num(a1),pick_down(a6)
- move.l a1,clue_DnEntry(a6) ;save ptr to list entry
-
- move.w d0,pick_Dnh(a6) ;else set up the
- move.w d2,pick_Dnv(a6) ;clue information
- bra.s WCH_19 ;and continue on
-
- WCH_B4 add.w #cle_sizeof,a1 ;next clue list entry
- subq.w #1,d7 ;done them all?
- bne.s WCH_L4 ;back if not
-
-
- * Now true across/down clues found, and details saved. Bye!!
-
-
- WCH_19 rts
-
-
- * GetClueText(a0,d0,d1) -> a0,d0
-
- * a0 = ptr to clue list header
- * d0 = clue number
- * d1 = 0 for across clue, 1 for down clue
-
- * Scan clue lists & return ptr to clue text.
-
- * Returns:
-
- * a0 = ptr to clue text, or NULL if no clue text coupled to
- * this clue
-
- * d0 = 0 if valid clue text ptr,
- * 1 if clue not in list
- * 2 if no valid list
-
-
- * d2/a1 corrupt
-
-
- GetClueText tst.b d1 ;across or down?
- bne.s GCT_1 ;skip if down clue wanted
-
- move.l clh_AcList(a0),d2 ;check clue list
- beq.s GCT_Error ;woops! doesn't exist
-
- move.l d2,a1 ;ptr to Across list
- move.w clh_AcCount(a0),d3 ;no of clues
-
- GCT_2 cmp.w (a1),d0 ;found it?
- beq.s GCT_3 ;skip if so
-
- add.w #cle_sizeof,a1 ;else point to next entry
- subq.w #1,d3 ;scanned entire list?
- bne.s GCT_2 ;no, back for more
-
- sub.l a0,a0 ;haven't found it, so
- moveq #1,d0 ;clue not in list
- rts
-
- GCT_3 move.l cle_Text(a1),a0 ;else get text pointer
- move.l a0,d0 ;NULL pointer?
- bne.s GCT_Done ;skip if not
-
- moveq #1,d0 ;else signal fact
- rts
-
-
- * Here, it's a down clue. Go get it if it's there...
-
-
- GCT_1 move.l clh_DnList(a0),d2 ;check clue list
- beq.s GCT_Error ;woops! doesn't exist
-
- move.l d2,a1 ;ptr to Down list
- move.w clh_DnCount(a0),d3 ;no of clues
-
- GCT_4 cmp.w (a1),d0 ;found it?
- beq.s GCT_5 ;skip if so
-
- add.w #cle_sizeof,a1 ;else point to next entry
- subq.w #1,d3 ;scanned entire list?
- bne.s GCT_4 ;no, back for more
-
- sub.l a0,a0 ;haven't found it, so
- moveq #1,d0 ;clue not in list
- rts
-
- GCT_5 move.l cle_Text(a1),a0 ;else get text pointer
- move.l a0,d0 ;NULL pointer?
- bne.s GCT_Done ;skip if not
-
- moveq #1,d0 ;else signal fact
- rts
-
-
- GCT_Done moveq #0,d0 ;signal valid clue list
- rts
-
- GCT_Error moveq #2,d0 ;cock up
- rts
-
-
- * SetClueText(a0,a1,d0,d1) -> d0
-
- * a0 = ptr to clue list header
- * a1 = ptr to text to set
- * d0 = clue number
- * d1 = 0 for across clue, 1 for down clue
-
- * Set text pointer for clue specified in arguments.
-
- * Returns:
-
- * d0 = 0 if valid clue list & clue exists
- * 1 if clue not in list
- * 2 if no valid list
-
- * Note:if text pointed to by a1 is a null string, then the
- * pointer is converted to NULL prior to being set into the
- * clue list entry!
-
-
- * d2/a1-a2 corrupt
-
-
- SetClueText tst.b (a1) ;null string?
- bne.s SCT_ok ;no
-
- sub.l a1,a1 ;else make null pointer!
-
- SCT_ok tst.b d1 ;across or down?
- bne.s SCT_1 ;skip if down clue wanted
-
- move.l clh_AcList(a0),d2 ;check clue list
- beq.s SCT_Error ;woops! doesn't exist
-
- move.l d2,a2 ;ptr to Across list
- move.w clh_AcCount(a0),d3 ;no of clues
-
- SCT_2 cmp.w (a2),d0 ;found it?
- beq.s SCT_3 ;skip if so
-
- add.w #cle_sizeof,a2 ;else point to next entry
- subq.w #1,d3 ;scanned entire list?
- bne.s SCT_2 ;no, back for more
-
- moveq #1,d0 ;clue not in list
- rts
-
- SCT_3 move.l a1,cle_Text(a2) ;else get text pointer
- bra.s SCT_Done
-
-
- * Here, it's a down clue. Go get it if it's there...
-
-
- SCT_1 move.l clh_DnList(a0),d2 ;check clue list
- beq.s SCT_Error ;woops! doesn't exist
-
- move.l d2,a2 ;ptr to Down list
- move.w clh_DnCount(a0),d3 ;no of clues
-
- SCT_4 cmp.w (a2),d0 ;found it?
- beq.s SCT_5 ;skip if so
-
- add.w #cle_sizeof,a2 ;else point to next entry
- subq.w #1,d3 ;scanned entire list?
- bne.s SCT_4 ;no, back for more
-
- moveq #1,d0 ;clue not in list
- rts
-
- SCT_5 move.l a1,cle_Text(a2) ;else get text pointer
-
- SCT_Done moveq #0,d0 ;signal valid clue list
- rts
-
- SCT_Error moveq #2,d0 ;cock up
- rts
-
-
- * GetNewText() -> a0,CCR
- * obtain ptr to text buffer for the string gadget
-
- * Returns ptr to text in a0
- * also, Z flag of CCR set if text is a null string,
- * cleared otherwise.
-
- * a0 only affected
-
-
- GetNewText lea GetClue(pc),a0
- move.l gg_SpecialInfo(a0),a0
- move.l si_Buffer(a0),a0
- tst.b (a0)
- rts
-
-
- * SetReqText(a1)
- * a1 = ptr to text to copy into req string gadget buffer
-
- * a0-a1 corrupt
-
-
- SetReqText lea GetClue(pc),a0
- move.l gg_SpecialInfo(a0),a0
- clr.w si_BufferPos(a0)
- move.l si_Buffer(a0),a0
-
- move.l a1,d0 ;NULL pointer?
- beq.s SRT_B1 ;skip if so
-
- SRT_L1 move.b (a1)+,(a0)+ ;else copy text across
- bne.s SRT_L1
-
- rts
-
- SRT_B1 clr.b (a0) ;else set null string
- rts
-
-
- * EditClue(a6)
- * a6 = ptr to main program variables
-
- * Pick clue to edit text for, then pop up another
- * requester with the string gadget for the text.
-
-
- * ALL REGISTERS CORRUPT
-
-
- EditClue btst #1,applic_flag2(a6) ;HELP on?
- beq.s ECL_Doit ;skip if not
-
- lea Help_AC(pc),a0 ;else pop up
- moveq #4,d0 ;help box
- bsr _PopUpQR
-
- beq ECL_Done
-
- ECL_Doit btst #4,applic_flag1(a6) ;clue list exists?
- bne.s ECL_OK ;skip if so
-
- lea NoClues(pc),a0
- lea QRT_1(pc),a1
- moveq #5,d0
-
- move.l a0,irt_tlist(a6) ;inform user that a clue
- move.l a1,irt_itext(a6) ;list is needed & ask if
- move.w d0,irt_count(a6) ;user wants to build one
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;YES gadget hit?
- beq ECL_Done ;skip if not
-
- bsr CCL_00 ;create clue list
-
- btst #4,applic_flag1(a6) ;got it?
- beq ECL_Done ;exit if not
-
-
- * If we reach here, then we've got a clue list and we can add to it.
- * Get clue to add to it from user.
-
-
- ECL_OK bsr PickClue ;see above
-
-
- * Now handle mouse events here, until a clue has been picked.
- * Temporarily restrict IDCMP to MOUSEMOVE/MOUSEBUTTONS and the
- * gadget selection IDCMPs only (latter to allow grid to be
- * scrolled to find clue to solve etc!).
- * Then recover the normal IDCMP at the end.
-
-
- move.l mw_handle(a6),a0
- move.l #MOUSEMOVE+MOUSEBUTTONS,d0
- add.l #GADGETDOWN+GADGETUP,d0
-
- CALLINT ModifyIDCMP
-
- ECL_1 move.l mw_userport(a6),a0
- lea ehb_std(pc),a5
-
- bsr DoEvent ;completely event driven!
-
- btst #3,applic_flag1(a6) ;picked a clue?
- bne.s ECL_1 ;loop until done
-
- move.l grid_array(a6),a0
- add.l grid_offset(a6),a0 ;point to square data
- move.w (a0),d0 ;get square data
- tst.b d0 ;check if white square
- bne.s ECL_1a ;and continue if OK
-
- lea BlackIsNoNo(pc),a0
- lea IRT_1(pc),a1
- moveq #3,d0
-
- move.l a0,irt_tlist(a6) ;inform user that a
- move.l a1,irt_itext(a6) ;white square MUST
- move.w d0,irt_count(a6) ;be selected!
-
- bsr LinkInfoText
- bsr ShowInfoReq
-
- rts
-
- ECL_1a bsr WhichClue ;find which clue picked
-
-
- * Here, check if across clue picked. If not, skip this section.
- * If yes, pop up QueryRequester. If user responds by hitting the
- * "YES" gadget, edit the clue, else skip to checking down clue.
-
-
- move.w pick_across(a6),d0 ;any across clue?
- beq ECL_2 ;no
-
- tst.w pick_down(a6) ;any down clue?
- beq.s ECL_Z1 ;skip if not
-
- lea QRT_1(pc),a0
- lea EAC_YN(pc),a1
- moveq #3,d0
-
- move.l a0,irt_itext(a6) ;else pop up a
- move.l a1,irt_tlist(a6) ;QueryReq
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;"YES" gadget hit?
- beq ECL_2 ;skip if not
-
-
- * Now initialise rhb_ structure for HandleRequest() for each
- * call (there'll be 2 for any picked square linked to both an
- * across and a down clue).
-
-
- ECL_Z1 move.l ThisReq(a6),a4
-
- move.l mw_handle(a6),rhb_Window(a4)
- move.l mw_userport(a6),rhb_UserPort(a4)
- move.l mw_IDCMP(a6),rhb_IDCMP(a4)
- lea EdClueReq(pc),a0
- move.l a0,rhb_Requester(a4)
-
- ; clr.l rhb_PreCode(a4)
-
- lea ReadyToEdit(pc),a0 ;see below
- move.l a0,rhb_PreCode(a4)
-
- move.l clue_list(a6),a0
- moveq #0,d1 ;across clue
- bsr GetClueText ;get text ptr
- cmp.w #2,d0 ;error?
- beq.s ECL_2 ;skip if so
-
- move.l a0,clue_thisone(a6) ;save text ptr
-
- move.l a0,a1 ;if a clue text exists then
- bsr SetReqText ;pop into the string gadget
-
- bsr TXAcross
-
- bsr HandleRequest
-
- bsr ReOrderText ;shuffle the text list
-
- bsr GetNewText ;get gadget text
-
- ; move.w CCR,d7 ;save flags for now
-
- CALLEXEC GetCC ;get flags
- move.w d0,d7 ;save them
-
- move.l a0,d6 ;save text ptr
-
- move.l clue_endptr(a6),a1 ;will be true text ptr
- move.b (a0),(a1) ;copy 1st char of string
- move.l clue_list(a6),a0
- move.w pick_across(a6),d0
- moveq #0,d1 ;across clue
- bsr SetClueText ;set text ptr
-
- move.w d7,CCR ;text ptr NULL?
- beq.s ECL_2 ;skip if so
-
- move.l clue_endptr(a6),a0 ;else append text to list
- move.l d6,a1 ;this text!
-
- ECL_C1 move.b (a1)+,(a0)+ ;copy text
- bne.s ECL_C1
-
- move.l a0,clue_endptr(a6) ;new end of texts
-
-
- * Here, check if down clue picked. If not, skip this section.
- * If yes, pop up QueryRequester. If user responds by hitting the
- * "YES" gadget, edit the clue, else skip to checking down clue.
-
-
- ECL_2 move.w pick_down(a6),d0 ;any down clue?
- beq ECL_Done ;no
-
- tst.w pick_across(a6) ;any across clue?
- beq.s ECL_Z2 ;skip if not
-
- lea QRT_1(pc),a0
- lea EDC_YN(pc),a1
- moveq #3,d0
-
- move.l a0,irt_itext(a6) ;else pop up a
- move.l a1,irt_tlist(a6) ;QueryReq
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;"YES" gadget hit?
- beq ECL_Done ;skip if not
-
-
- * Now initialise rhb_ structure for HandleRequest() for each
- * call (there'll be 2 for any picked square linked to both an
- * across and a down clue).
-
-
- ECL_Z2 move.l ThisReq(a6),a4
-
- move.l mw_handle(a6),rhb_Window(a4)
- move.l mw_userport(a6),rhb_UserPort(a4)
- move.l mw_IDCMP(a6),rhb_IDCMP(a4)
- lea EdClueReq(pc),a0
- move.l a0,rhb_Requester(a4)
-
- ; clr.l rhb_PreCode(a4)
-
- lea ReadyToEdit(pc),a0 ;see below
- move.l a0,rhb_PreCode(a4)
-
- move.l clue_list(a6),a0
- moveq #1,d1 ;down clue
- bsr GetClueText ;get text ptr
- cmp.w #2,d0 ;error?
- beq.s ECL_Done ;skip if so
-
- move.l a0,clue_thisone(a6) ;save text ptr
-
- move.l a0,a1 ;if a clue text exists then
- bsr SetReqText ;pop into the string gadget
-
- bsr TXDown
-
- bsr HandleRequest
-
- bsr ReOrderText ;shuffle the text list
-
- bsr GetNewText ;get gadget text
-
- ; move.w CCR,d7 ;save flags for now
-
- CALLEXEC GetCC ;get flags
- move.w d0,d7 ;save them
-
- move.l a0,d6 ;save text ptr
-
- move.l clue_endptr(a6),a1 ;will be true text ptr
- move.b (a0),(a1) ;copy 1st char of string
- move.l clue_list(a6),a0
- move.w pick_down(a6),d0
- moveq #1,d1 ;down clue
- bsr SetClueText ;set text ptr
-
- move.w d7,CCR ;text ptr NULL?
- beq.s ECL_Done ;skip if so
-
- move.l clue_endptr(a6),a0 ;else append text to list
- move.l d6,a1 ;this text!
-
- ECL_C2 move.b (a1)+,(a0)+ ;copy text
- bne.s ECL_C2
-
- move.l a0,clue_endptr(a6) ;new end of texts
-
- ECL_Done moveq #-1,d0 ;stop spurious
- move.w d0,mp_across(a6) ;square changing when
- move.w d0,mp_down(a6) ;quitting requester
-
- move.l mw_handle(a6),a0
- move.l mw_IDCMP(a6),d0
-
- CALLINT ModifyIDCMP ;make sure IDCMP back!
-
- move.l mw_handle(a6),a0
- CALLINT ActivateWindow
-
- rts
-
-
- * Precode for above requester...
-
-
- * ReadyToEdit(a4)
- * a4 = ptr to initialised requester handler block
-
- * Activates the string gadget on the Edit Clue requester
- * or at least tries to...
-
- * a0-a2 corrupt (plus poss. d0-d2 also!)
-
-
- ReadyToEdit lea GetClue(pc),a0
- move.l rhb_Window(a4),a1
- move.l rhb_Requester(a4),a2
-
- CALLINT ActivateGadget
-
- rts
-
-
- * EraseClue(a6)
- * a6 = ptr to main program variables
-
- * Perform the "Erase Clue Text" function selected
- * via the menu.
-
- * Assume ALL registers corrupt!
-
-
- EraseClue btst #1,applic_flag2(a6) ;HELP on?
- beq.s ERL_Doit ;skip if not
-
- lea Help_RC(pc),a0 ;else pop up a
- moveq #4,d0 ;help box
- bsr _PopUpQR
-
- beq ERL_B2
-
- ERL_Doit btst #4,applic_flag1(a6) ;clue list exists?
- bne.s ERL_OK ;skip if so
-
- lea NoClues(pc),a0
- lea QRT_1(pc),a1
- moveq #5,d0
-
- move.l a0,irt_tlist(a6) ;else inform user that
- move.l a1,irt_itext(a6) ;a clue list is needed
- move.w d0,irt_count(a6) ;& ask user if one wanted
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;YES gadget hit?
- beq ERL_B2 ;exit if not
-
- bsr CCL_00 ;else build clue list
-
- rts
-
- ERL_OK bsr PickClue ;see above
-
-
- * Now handle mouse events here, until a clue has been picked.
- * Temporarily restrict IDCMP to MOUSEMOVE/MOUSEBUTTONS and the
- * gadget selection IDCMPs only (latter to allow grid to be
- * scrolled to find clue to solve etc!).
- * Then recover the normal IDCMP at the end.
-
-
- move.l mw_handle(a6),a0
- move.l #MOUSEMOVE+MOUSEBUTTONS,d0
- add.l #GADGETDOWN+GADGETUP,d0
-
- CALLINT ModifyIDCMP
-
- ERL_1 move.l mw_userport(a6),a0
- lea ehb_std(pc),a5
-
- bsr DoEvent ;completely event driven!
-
- btst #3,applic_flag1(a6) ;picked a clue?
- bne.s ERL_1 ;loop until done
-
- move.l grid_array(a6),a0
- add.l grid_offset(a6),a0 ;point to square data
- move.w (a0),d0 ;get square data
- tst.b d0 ;check if white square
- bne.s ERL_1a ;and continue if OK
-
- lea BlackIsNoNo(pc),a0
- lea IRT_1(pc),a1
- moveq #3,d0
-
- move.l a0,irt_tlist(a6) ;inform user that a
- move.l a1,irt_itext(a6) ;white square MUST
- move.w d0,irt_count(a6) ;be selected!
-
- bsr LinkInfoText
- bsr ShowInfoReq
-
- rts
-
- ERL_1a bsr WhichClue ;find which clue picked
-
-
- * Check if Across clue selected. If not, skip this section.
-
-
- move.w pick_across(a6),d0 ;got across clue?
- beq.s ERL_B1 ;skip if not
-
- tst.w pick_down(a6) ;down clue also?
- beq.s ERL_Z1 ;skip if not
-
- lea QRT_1(pc),a0
- lea DAC_YN(pc),a1
- moveq #3,d0
-
- move.l a0,irt_itext(a6) ;else pop up a
- move.l a1,irt_tlist(a6) ;QueryReq
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;"YES" gadget hit?
- beq.s ERL_B1 ;skip if not
-
- ERL_Z1 move.l clue_list(a6),a0
- moveq #0,d1 ;across clue
- bsr GetClueText ;get text ptr
- cmp.w #2,d0 ;error?
- beq.s ERL_B1 ;skip if so
-
- move.l a0,clue_thisone(a6) ;save text ptr
-
- bsr ReOrderText ;shuffle the text list
-
-
- * Check if Down clue selected. If not, skip this section.
-
-
- ERL_B1 move.w pick_down(a6),d0 ;down clue?
- beq.s ERL_B2 ;skip if not
-
- tst.w pick_across(a6) ;across clue also?
- beq.s ERL_Z2 ;skip if not
-
- lea QRT_1(pc),a0
- lea DDC_YN(pc),a1
- moveq #3,d0
-
- move.l a0,irt_itext(a6) ;else pop up a
- move.l a1,irt_tlist(a6) ;QueryReq
- move.w d0,irt_count(a6)
-
- bsr DoQueryReq
-
- btst #6,applic_flag2(a6) ;"YES" gadget hit?
- beq.s ERL_B2 ;skip if not
-
- ERL_Z2 move.l clue_list(a6),a0
- moveq #1,d1 ;down clue
- bsr GetClueText ;get text ptr
- cmp.w #2,d0 ;error?
- beq.s ERL_B2 ;skip if so
-
- move.l a0,clue_thisone(a6) ;save text ptr
-
- bsr ReOrderText ;shuffle the text list
-
- ERL_B2 moveq #-1,d0 ;stop spurious
- move.w d0,mp_across(a6) ;square changing when
- move.w d0,mp_down(a6) ;quitting requester
-
- move.l mw_handle(a6),a0
- move.l mw_IDCMP(a6),d0
-
- CALLINT ModifyIDCMP ;make sure IDCMP back!
-
- move.l mw_handle(a6),a0
- CALLINT ActivateWindow
-
- rts
-
- * TXAcross(a6)
- * a6 = ptr to main program variables
- * pop in the message for "XXXX Across" into the
- * text for the above requester.
-
- * d0-d1/a0-a1 corrupt
-
-
- TXAcross lea IT_Alt1(pc),a0
- lea ITT_Alt1(pc),a1
-
- move.l a1,12(a0) ;pop in text ptr
- move.w #64,4(a0) ;and starting x position
-
- move.l 16(a0),a0 ;ptr to next IText
-
- move.l a1,12(a0) ;pop in text ptr
- move.w #63,4(a0) ;and starting x position
-
- addq.l #7,a1 ;point to "XXXX"
- move.l a1,-(sp) ;save ptr to number text
-
- move.l a1,a0
- moveq #0,d0
- move.w pick_across(a6),d0 ;clue no.
- moveq #4,d1 ;field width
- bsr ItoA ;integer to ASCII convert
-
- move.l (sp)+,a1 ;recover pointer
-
- TXA_1 tst.b (a1)+ ;find the NULL inserted by ITOA
- bne.s TXA_1
-
- move.b #" ",-1(a1) ;and put the space back
-
- rts
-
-
- * TXDown(a6)
- * a6 = ptr to main program variables
- * pop in the message for "XXXX Across" into the
- * text for the above requester.
-
- * d0-d1/a0-a1 corrupt
-
-
- TXDown lea IT_Alt1(pc),a0
- lea ITT_Alt2(pc),a1
-
- move.l a1,12(a0) ;pop in text ptr
- move.w #72,4(a0) ;and starting x position
-
- move.l 16(a0),a0 ;ptr to next IText
-
- move.l a1,12(a0) ;pop in text ptr
- move.w #71,4(a0) ;and starting x position
-
- addq.l #7,a1 ;point to "XXXX"
- move.l a1,-(sp) ;save ptr to number text
-
- move.l a1,a0
- moveq #0,d0
- move.w pick_down(a6),d0 ;clue no.
- moveq #4,d1 ;field width
- bsr ItoA ;integer to ASCII convert
-
- move.l (sp)+,a1 ;recover pointer
-
- TXD_1 tst.b (a1)+ ;find the NULL inserted by ITOA
- bne.s TXD_1
-
- move.b #" ",-1(a1) ;and put the space back
-
- rts
-
-
- * Edit Clue Requester.
-
-
- EdClueReq:
-
- dc.l NULL
- dc.w 25,12
- dc.w 270,220
- dc.w 0,0
- dc.l EdReqGList
- dc.l NULL
- dc.l NULL ;EdReqTList
- dc.w NULL
- dc.b 1,0
- dc.l NULL
- dcb.b 32,0
- dc.l NULL
- dc.l NULL
- dcb.b 36,0
-
-
- EdReqGList:
-
- GetClue:
- dc.l EdPanel
- dc.w 88,188
- dc.w 100,8
- dc.w GADGIMAGE
- dc.w GADGIMMEDIATE+RELVERIFY+ENDGADGET
- dc.w STRGADGET+REQGADGET
- dc.l GetClueBox
- dc.l NULL
- dc.l NULL
- dc.l NULL
- dc.l GetClueSInfo
- dc.w NULL
- dc.l DoneRG ;extra entry!
- dc.l QuitReq
-
- GetClueSInfo:
- dc.l GetClueSIBuff
- dc.l UNDOBUFFER
- dc.w 0
- dc.w 256
- dc.w 0
- dc.w 0,0,0,0,0
- dc.l 0
- dc.l 0
- dc.l NULL
-
- GetClueSIBuff:
- dcb.b 256,0
- cnop 0,2
-
- GetClueBox:
- dc.w -5,-6
- dc.w 110,20
- dc.w 4
- dc.l HBox2Data
- dc.b $000F,$0000
- dc.l NULL
-
- EdPanel:
- dc.l NULL
- dc.w 0,0
- dc.w 270,220
- dc.w GADGHBOX+GADGHIMAGE+GADGIMAGE
- dc.w NULL
- dc.w BOOLGADGET+REQGADGET
- dc.l PanelImage
- dc.l NULL
- dc.l EdReqTList
- dc.l NULL
- dc.l GetClueSInfo
- dc.w NULL
- dc.l NULL
- dc.l NULL ;extra entry!
-
-
- EdReqTList:
- IT_15:
- dc.b 9,0,RP_JAM1,0
- dc.w 64,13
- dc.l NULL
- dc.l ITT15
- dc.l IT_16
-
- ITT15:
- dc.b 'Edit Clue Question',0
- cnop 0,2
-
- IT_16:
- dc.b 1,0,RP_JAM1,0
- dc.w 63,12
- dc.l NULL
- dc.l ITT15
- dc.l IT_Alt1
-
- IT_Alt1:
- dc.b 4,0,RP_JAM1,0
- dc.w 64,49
- dc.l NULL
- dc.l ITT_Alt1
- dc.l IT_Alt2
-
- ITT_Alt1:
- dc.b "Clue : XXXX Across",0
-
- ITT_Alt2:
- dc.b "Clue : XXXX Down",0
- cnop 0,2
-
- IT_Alt2:
- dc.b 5,0,RP_JAM1,0
- dc.w 63,48
- dc.l NULL
- dc.l ITT_Alt1
- dc.l IT_17
-
- IT_17:
- dc.b 9,0,RP_JAM1,0
- dc.w 32,63
- dc.l NULL
- dc.l ITT17
- dc.l IT_18
-
- ITT17:
- dc.b 'Enter New Clue Text In The',0
- cnop 0,2
-
- IT_18:
- dc.b 1,0,RP_JAM1,0
- dc.w 31,62
- dc.l NULL
- dc.l ITT17
- dc.l IT_19
-
- IT_19:
- dc.b 9,0,RP_JAM1,0
- dc.w 36,77
- dc.l NULL
- dc.l ITT19
- dc.l IT_20
-
- ITT19:
- dc.b 'Box Below, And Then Press',0
- cnop 0,2
-
- IT_20:
- dc.b 1,0,RP_JAM1,0
- dc.w 35,76
- dc.l NULL
- dc.l ITT19
- dc.l IT_21
-
- IT_21:
- dc.b 9,0,RP_JAM1,0
- dc.w 72,91
- dc.l NULL
- dc.l ITT21
- dc.l IT_22
-
- ITT21:
- dc.b 'The "Enter" Key.',0
- cnop 0,2
-
- IT_22:
- dc.b 1,0,RP_JAM1,0
- dc.w 71,90
- dc.l NULL
- dc.l ITT21
- dc.l NULL
-
-
-
-
-
-
-